<%= form_for(@user) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <fieldset>
    <legend>Informations générales</legend>

    <div class="field">
      <%= f.label :username %>
      <%= f.text_field :username %>
    </div>
    <div class="field">
      <%= f.label :email %>
      <%= f.text_field :email %>
    </div>
    <div class="field">
      <%= f.label :password %>
      <%= f.password_field :password %>
    </div>
    <div class="field">
      <%= f.label :password_confirmation %>
      <%= f.password_field :password_confirmation %>
    </div>
    <div class="field">
      <%= f.label :avatar %>
      <%= f.file_field :avatar %>
      <% if user_signed_in? %>
        <%= image_tag current_user.avatar.url(:medium) %>
      <% end %>
    </div>
    <div class="field">
      <%= f.label :description %>
      <%= f.text_field :description %>
    </div>
    <div class="field">
      <%= f.label :skills %>
      <%= f.text_field :skills %>
    </div>
  </fieldset>

  <fieldset>
    <legend>Coordonnées</legend>

    <div class="field">
      <%= f.label :name %>
      <%= f.text_field :name %>
    </div>
    <div class="field">
      <%= f.label :first_name %>
      <%= f.text_field :first_name %>
    </div>

    <div class="field">
      <%= f.label :adress %>
      <%= f.text_field :adress %>
    </div>
    <div class="field">
      <%= f.label :city %>
      <%= f.text_field :city %>
    </div>
    <div class="field">
      <%= f.label :cp %>
      <%= f.number_field :cp %>
    </div>
    <div class="field">
      <%= f.label :phone %>
      <%= f.text_field :phone %>
    </div>
  </fieldset>
  <div class="actions">
    <%= f.submit "Valider" %>
  </div>
<% end %>
